﻿package com.firewolf.decorator.main;

import com.firewolf.decorator.condiment.Mocha;
import com.firewolf.decorator.condiment.Soy;
import com.firewolf.decorator.condiment.Whip;
import com.firewolf.decorator.drinks.Beverage;
import com.firewolf.decorator.drinks.DarkRoast;
import com.firewolf.decorator.drinks.Espresso;
import com.firewolf.decorator.drinks.HouseBlend;

/**
 * 装饰者主函数
 * @author liuxing0
 * @function
 * @createtime 2014-8-21
 */
public class DecoratorMain {
	public static void main(String[] args) {
		Beverage beverage = new Espresso(); //定一杯Espresso，不需要调料，打印出他的描述与价钱
		System.out.println(beverage.getDescription()+" $"+beverage.cost());
		
		Beverage beverage2 = new DarkRoast(); //制造一个DarkRoast对象
		beverage2 = new Mocha(beverage2);//用Mocha装饰它
		beverage2 = new Mocha(beverage2);//用第二个Mocha装饰它
		beverage2 = new Whip(beverage2);//用Whip来装饰它
		System.out.println(beverage2.getDescription()+" $"+beverage2.cost()); 
		
		Beverage beverage3 = new HouseBlend(); //制造一个HouseBlend对象
		beverage3 = new Mocha(beverage3);//用Mocha装饰它
		beverage3 = new Whip(beverage3);//用Whip装饰它
		beverage3 = new Soy(beverage3);//用Soy来装饰它
		System.out.println(beverage3.getDescription()+" $"+beverage3.cost()); 
	}
}
